#include <Windows.h>
#include "CStandardMessagePacket.h"

CStandardMessagePacket::CStandardMessagePacket(CChar * schar, unsigned short mId) {

	memset(this->data, 0, sizeof(this->data));
	this->type = 0x09;
	if(mId == 0x0059) {
		this->size = 0x30;
		this->data[0x0C-0x04] = 0x10;
		memcpy(this->data+0x0D-0x04, "string2 ", 8);
		memcpy(this->data+0x15-0x04, schar->m_name, sizeof(schar->m_name));
	}
	else this->size = 0x10;

	unsigned short targId = schar->getTargId();
	memcpy(this->data+0x08-0x04, &targId, 2);

	memcpy(this->data+0x0A-0x04, &mId, 2);

}

CStandardMessagePacket::CStandardMessagePacket(unsigned short mId, unsigned int mParam) {

	memset(this->data, 0, sizeof(this->data));
	this->type = 0x09;
	if(mId == 0x00D0) {
		this->size = 0x0E;
		//this->data[0x0C-0x04] = 0x10;
		sprintf((char *)this->data+0x0D-0x04,"Para0 %d", mParam);
		//memcpy(this->data+0x0D-0x04, "Para0 %d", 8);
		//memcpy(this->data+0x15-0x04, schar->m_name, sizeof(schar->m_name));
	}
	else this->size = 0x10;

	memcpy(this->data+0x0A-0x04, &mId, 2);

}

CStandardMessagePacket::CStandardMessagePacket(unsigned short mId) {

	memset(this->data, 0, sizeof(this->data));
	this->type = 0x09;
	this->size = 0x08;

	memcpy(this->data+0x0A-0x04, &mId, 2);

}

CStandardMessagePacket::~CStandardMessagePacket() {

}